﻿using System;
namespace Core
{
    class IdGenerater
    {
        private static long value = 0;
        private static DateTime dt1970 = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
        public static long GenerateId()
        {
            var dx = (DateTime.Now.Ticks - dt1970.Ticks) / 10000;
            long epoch1970tick = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).Ticks / 10000;
            var epoch2020 = new DateTime(2020, 1, 1, 0, 0, 0, DateTimeKind.Utc).Ticks / 10000 - epoch1970tick;
            uint a = (uint)((dx - epoch2020) / 1000);
            value++;

            return a+value;
        }
    }
}
